package cn.jingyuan.bee.utils.convert.impl;

import cn.jingyuan.bee.utils.BooleanUtils;
import cn.jingyuan.bee.utils.convert.AbstractConverter;

/**
 * 布尔转换器
 */
public class BooleanConverter extends AbstractConverter<Boolean> {

    @Override
    protected Boolean convertInternal(Object value) {
        if (boolean.class == value.getClass()) {
            return Boolean.valueOf((boolean) value);
        }
        String valueStr = convertToStr(value);
        return Boolean.valueOf(BooleanUtils.toBoolean(valueStr));
    }

}
